/*
 * DC_Motor.c
 *
 * Created:			04.08.2012 18:15:45
 * Author:			boecki91@gmail.com
 * Target:			atMEGA644P
 * URL:				$HeadURL: http://dc-motor-regelung.googlecode.com/svn/trunk/Software/DC_Motor.c $
 * Last changed by:	$Author: boecki91@gmail.com $
 * Changed date:    $Date: 2012-08-05 20:21:36 +0000 (Sun, 05 Aug 2012) $
 * Last committed:  $Revision: 12 $
 *
 * ID:				$Id: DC_Motor.c 12 2012-08-05 20:21:36Z boecki91@gmail.com $
 */ 


#include "global.h"
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include "uart.h"
#include "adc.h"
#include "dc_motor_current_control.h"

void uart_pwm_value(void);

int main(void)
{
	uart_init(UART_BAUD_SELECT(BAUD,F_CPU));

	adc_init();
	dc_motor_current_controll_init();
	//Interrupts on
	sei();

	//Program-Info output
	uart_puts("\nDC-Motor Regelung\nBuild: ");
	uart_puts(__TIME__);
	uart_puts(" ");
	uart_puts(__DATE__);
	uart_puts("\nSVN-");
	uart_puts("$Rev: 12 $\n");

	while(1)
    {
    }
}
void uart_pwm_value(void)
{
	uart_puts("PWM: ");
	uart_int((OCR1A*100.0)/ICR1);
	uart_puts("%\n");
}



ISR(TIMER0_COMPA_vect)
{
	dc_motor_current_controll_cycle();
}

